

**http://www.stata.com/support/faqs/data-management/creating-variables-recording-properties/
****Main Language variable of interest**
clear all
set maxvar 32767
*cd "/Users/rajeshramachandran/dropbox/latest_Version_Home_sharing/Latest_Draft/DataandDoFilesJune2017/AfroBarometer/Afrobarometer_Data
cd "C:\Users\r.ramachandran\Dropbox\latest_Version_Home_sharing\Latest_Draft\DataandDoFilesJune2017\AfroBarometer\Afrobarometer_Data"

*cd "C:\Users\ramachan\Dropbox\latest_Version_Home_sharing\Latest_Draft\DataandDoFilesJune2017\AfroBarometer\Afrobarometer_Data"
use merged4
//keep if COUNTRY==18
set more off
local written Q88E 

decode Q3, gen(Lang_Respondent)
gen all_languages = upper(Lang_Respondent+","+Q88E)

replace all_languages= ","+subinstr(all_languages,"  "," ",.)+","
replace all_languages= subinstr(all_languages,"    "," ",.)
replace all_languages= subinstr(all_languages,"   "," ",.)
replace all_languages= subinstr(all_languages,"  "," ",.)
replace all_languages= subinstr(all_languages,"  "," ",.)
replace all_languages= subinstr(all_languages,";",",",.)
replace all_languages= subinstr(all_languages,"/",",",.)
replace all_languages= subinstr(all_languages,"&",",",.)
replace all_languages= subinstr(all_languages,".",",",.)
replace all_languages= subinstr(all_languages," ,",",",.)
replace all_languages= subinstr(all_languages,", ",",",.)
replace all_languages= subinstr(all_languages," AND ",",",.)
replace all_languages= subinstr(all_languages," E ",",",.)
replace all_languages= subinstr(all_languages," ET ",",",.)
replace all_languages= subinstr(all_languages," + ",",",.)
replace all_languages= subinstr(all_languages," N ",",",.)
replace all_languages= subinstr(all_languages," 3 ",",",.)
replace all_languages= subinstr(all_languages," S ",",",.)

replace all_languages= subinstr(all_languages,",OTHER,",",",.)
replace all_languages= subinstr(all_languages,",OTHERS,",",",.)
replace all_languages= subinstr(all_languages,",KUSASI,",",KUSAASE,",.)
replace all_languages= subinstr(all_languages,",.IGBO ,",",IGBO,",.)
replace all_languages= subinstr(all_languages,",.IGBO,",",IGBO,",.)

//get rid of all " ", and "'"

replace all_languages= subinstr(all_languages,",A LITTLE ENGLISH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",AND ENGLISH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",AND SIMPLE ENGLISH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",NORTHERN SOTHO,",",NORTH-SOTHO,",.)
replace all_languages= subinstr(all_languages,",N SOTHO,",",NORTH-SOTHO,",.)
replace all_languages= subinstr(all_languages,",SIMPLE ENGLISH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",SIMPLE LIBERIAN ENGLISH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",SIMPLE ENGLISGH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",SIMPLE EMGLISH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",NGA'KARAMANJONG,",",NGAKARAMAJONG,",.)
replace all_languages= subinstr(all_languages,",YORUBA LANGUAGE,",",YORUBA,",.)
replace all_languages= subinstr(all_languages,",OSHIWAMBO (OSHINDONGO),",",OSHIWAMBO,",.)
replace all_languages= subinstr(all_languages,",OSHIWAMBO (OSHINDONGA),",",OSHIWAMBO,",.)
replace all_languages= subinstr(all_languages,",OSHIWAMBO (OSHIKWANYAMA),",",OSHIWAMBO,",.)
replace all_languages= subinstr(all_languages,",OSHIWAMBO (OSHIKOLOKADHI),",",OSHIWAMBO,",.)
replace all_languages= subinstr(all_languages,",MALAGASY WITH REGIONAL VARIATION,",",MALAGASY,",.)
replace all_languages= subinstr(all_languages,",ENGLISH LANGUAGE,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",SOME ENG,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",SOME ENGLISH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",E ESPANHOL,",",SPANISH,",.)

**here you know that " " means ","
replace all_languages= subinstr(all_languages," ",",",.)
replace all_languages= subinstr(all_languages,"-",",",.)
replace all_languages= subinstr(all_languages,"<",",",.)
replace all_languages= subinstr(all_languages,"_",",",.)
replace all_languages= subinstr(all_languages,"'",",",.)
*/

**change the names of the languages
replace all_languages= subinstr(all_languages,",AFIKAANS,",",AFRIKAANS,",.)
replace all_languages= subinstr(all_languages,",AFR,",",AFRIKAANS,",.)
replace all_languages= subinstr(all_languages,",AFRI,",",AFRIKAANS,",.)
replace all_languages= subinstr(all_languages,",AFRIK,",",AFRIKAANS,",.)
replace all_languages= subinstr(all_languages,",AFRIKAA,",",AFRIKAANS,",.)
replace all_languages= subinstr(all_languages,",AFRIKAAN,",",AFRIKAANS,",.)
replace all_languages= subinstr(all_languages,",AFRIKAANNS,",",AFRIKAANS,",.)
replace all_languages= subinstr(all_languages,",AFRIKAANSE,",",AFRIKAANS,",.)
replace all_languages= subinstr(all_languages,",AFRIKANCE,",",AFRIKAANS,",.)
replace all_languages= subinstr(all_languages,",AFRIKANS,",",AFRIKAANS,",.)
replace all_languages= subinstr(all_languages,",AFRIKANSE,",",AFRIKAANS,",.)
replace all_languages= subinstr(all_languages,",AFRILAANS,",",AFRIKAANS,",.)
replace all_languages= subinstr(all_languages,",AFIKPO,",",AFRIKAANS,",.)
replace all_languages= subinstr(all_languages,",AFRKAANS,",",AFRIKAANS,",.)
replace all_languages= subinstr(all_languages,",AWORI(EGAN),",",AWORI,",.)
replace all_languages= subinstr(all_languages,",AFRIK,",",AFRIKAANS,",.)



replace all_languages= subinstr(all_languages,",ANGL,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ANGLAI,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ANGLAIS,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ANGLISY,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ANGL,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ANGL,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGELS,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGISH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGL,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGLAND,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGLI,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGLIGS,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGLIHS,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGLIISH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGLIS,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGLISH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGLIISH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGLISHA,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGLISHJ,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGLISM,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGLLISH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGLSH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGL[SH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENHGLISH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENLISH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENNGLISH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENLISH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",EHGLISH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGILSH,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENG,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGLISH.,",",ENGLISH,",.)


replace all_languages= subinstr(all_languages,",ABU,",",ABUA,",.)
replace all_languages= subinstr(all_languages,",ABI,",",ABUA,",.)
replace all_languages= subinstr(all_languages,",ABERIW,",",ABUA,",.)

replace all_languages= subinstr(all_languages,",ADAGBE,",",ADANGBE,",.)
replace all_languages= subinstr(all_languages,",AD,",",ADANGBE,",.)
replace all_languages= subinstr(all_languages,",ADA,",",ADANGBE,",.)
replace all_languages= subinstr(all_languages,",ADAYME,",",ADANGBE,",.)

replace all_languages= subinstr(all_languages,",ADJ,",",ADJA,",.)



replace all_languages= subinstr(all_languages,",ARAB,",",ARABIC,",.)
replace all_languages= subinstr(all_languages,",ARABE,",",ARABIC,",.)
//replace all_languages= subinstr(all_languages,",ARABE,",",ARABIC,",.)
replace all_languages= subinstr(all_languages,",ARABI,",",ARABIC,",.)
replace all_languages= subinstr(all_languages,",AR,",",ARABIC,",.)

replace all_languages= subinstr(all_languages,",BELLE,",",BELLA,",.)


replace all_languages= subinstr(all_languages,",BWAMOU,",",BWAMU,",.)

replace all_languages= subinstr(all_languages,",CREOLE,",",CRIOULO,",.)
replace all_languages= subinstr(all_languages,",CREOLE,",",CRIOULO,",.)
replace all_languages= subinstr(all_languages,",CR�OLE,",",CRIOULO,",.)

replace all_languages= subinstr(all_languages,",DAGOMBA,",",DAGBANI,",.)

replace all_languages= subinstr(all_languages,",DA,",",DAFING,",.)
replace all_languages= subinstr(all_languages,",DAFIN,",",DAFING,",.)
replace all_languages= subinstr(all_languages,",DAFI,",",DAFING,",.)

replace all_languages= subinstr(all_languages,",DHOLUO,",",DIOULA,",.)
replace all_languages= subinstr(all_languages,",DHOLUO,",",DIOULA,",.)

replace all_languages= subinstr(all_languages,",CHICHEWA,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",CHIBEMBA,",",BEMBA,",.)


replace all_languages= subinstr(all_languages,",ESP,",",SPANISH,",.)
replace all_languages= subinstr(all_languages,",ESPAGNO,",",SPANISH,",.)
replace all_languages= subinstr(all_languages,",ESPAGNOL,",",SPANISH,",.)
replace all_languages= subinstr(all_languages,",ESPANHOL,",",SPANISH,",.)



replace all_languages= subinstr(all_languages,",ENGLISH(PIDGIN),",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",ENGLSH,",",ENGLISH,",.)


replace all_languages= subinstr(all_languages,",FANCAIS,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FARANCAIS,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FFRANCAIS,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRABCAIS,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRACH,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRAFRA,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRAICAIS,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRAN,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FANCAI,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRANCAIS.,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRANCES,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRANCIAS,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRANCIS,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FR,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRACAIS,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRAFRA,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRANCAI,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRANTA,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRANTSAY,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRAN�AIS,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRENCH,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRENCH.,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRENEH,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRNCAI,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FAN�AIS,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FOULCE,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FOULSE,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRANC�S,",",FRANCAIS,",.)



replace all_languages= subinstr(all_languages,",GA-ADAMGBE,",",GA,",.)


replace all_languages= subinstr(all_languages,",GERBO,",",GERMAN,",.)
replace all_languages= subinstr(all_languages,",GERMA,",",GERMAN,",.)

replace all_languages= subinstr(all_languages,",AJA,",",AJAUA,",.)
replace all_languages= subinstr(all_languages,",AJUA,",",AJAUA,",.)


replace all_languages= subinstr(all_languages,",AKA,",",AKAN,",.)
replace all_languages= subinstr(all_languages,",AKAM,",",AKAN,",.)
replace all_languages= subinstr(all_languages,",AKAN.,",",AKAN,",.)
replace all_languages= subinstr(all_languages,",AKAN(AKUAPEM),",",AKAN,",.)
replace all_languages= subinstr(all_languages,",AKUAPIM,",",AKAN,",.)
replace all_languages= subinstr(all_languages,",AKWA IBOM,",",AKAN,",.)
replace all_languages= subinstr(all_languages,",AKWAPIM,",",AKAN,",.)
replace all_languages= subinstr(all_languages,",AMAK,",",AKAN,",.)




replace all_languages= subinstr(all_languages,",ASHANTE,",",ASHANTI,",.)
replace all_languages= subinstr(all_languages,",ASANTE,",",AKAN,",.)
replace all_languages= subinstr(all_languages,",ACHANTI,",",AKAN,",.)

replace all_languages= subinstr(all_languages,",ANDORI,",",ANDONI,",.)


replace all_languages= subinstr(all_languages,",BABAR,",",BABUR,",.)
replace all_languages= subinstr(all_languages,",BABUK,",",BABUR,",.)
replace all_languages= subinstr(all_languages,",BABURO,",",BABUR,",.)
replace all_languages= subinstr(all_languages,",BABURU,",",BABUR,",.)

replace all_languages= subinstr(all_languages,",BELLE,",",BELLA,",.)


replace all_languages= subinstr(all_languages,",BANIBA,",",BARIBA,",.)
replace all_languages= subinstr(all_languages,",BARABI,",",BARIBA,",.)
replace all_languages= subinstr(all_languages,",BARBAIG,",",BARIBA,",.)
replace all_languages= subinstr(all_languages,",BARIB,",",BARIBA,",.)
replace all_languages= subinstr(all_languages,",BARIDA,",",BARIBA,",.)
replace all_languages= subinstr(all_languages,",BARBARCHI,",",BARIBA,",.)
	

replace all_languages= subinstr(all_languages,",BAMB,",",BAMBARA,",.)

	
replace all_languages= subinstr(all_languages,",BASSARI,",",BASSA,",.)
replace all_languages= subinstr(all_languages,",BASSEL,",",BASSA,",.)

replace all_languages= subinstr(all_languages,",BEMRA,",",BEMBA,",.)
replace all_languages= subinstr(all_languages,",BEMUBA,",",BEMBA,",.)
replace all_languages= subinstr(all_languages,",BEMGK,",",BEMBA,",.)
replace all_languages= subinstr(all_languages,",BFMBA,",",BEMBA,",.)
replace all_languages= subinstr(all_languages,",BGMBA,",",BEMBA,",.)
replace all_languages= subinstr(all_languages,",BIMOBA,",",BEMBA,",.)
replace all_languages= subinstr(all_languages,",BIMOBA[GRUMA],",",BEMBA,",.)


replace all_languages= subinstr(all_languages,",BISA,",",BISSA,",.)
replace all_languages= subinstr(all_languages,",BISAB,",",BISSA,",.)


replace all_languages= subinstr(all_languages,",BOBOB,",",BOBO,",.)
replace all_languages= subinstr(all_languages,",BOBOFI,",",BOBO,",.)

replace all_languages= subinstr(all_languages,",CHANGAAN,",",CHANGANA,",.)
replace all_languages= subinstr(all_languages,",CHANGA,",",CHANGANA,",.)
replace all_languages= subinstr(all_languages,",CHAN,",",CHANGANA,",.)
replace all_languages= subinstr(all_languages,",CAHANGANA,",",CHANGANA,",.)
replace all_languages= subinstr(all_languages,",CHANGANATEU,",",CHANGANA,",.)
replace all_languages= subinstr(all_languages,",CHANGANI,",",CHANGANA,",.)
replace all_languages= subinstr(all_languages,",SECHANKANA,",",CHANGANA,",.)
replace all_languages= subinstr(all_languages,",SECHANGANI,",",CHANGANA,",.)
replace all_languages= subinstr(all_languages,",SECHANGANE,",",CHANGANA,",.)
replace all_languages= subinstr(all_languages,",SECHANGANA,",",CHANGANA,",.)



replace all_languages= subinstr(all_languages,",CHAWA,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",CHAWE,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",CHEICHEWA,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",CHEUA,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",CHEUE,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",CHEUWA,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",CHEWA1,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",CHEWE,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",CHEW,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",CHIAO,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",CHIAO CHICHEWA,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",CHICHEA,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",CHICHEWA,",",CHEWA,",.)

replace all_languages= subinstr(all_languages,",CHICHEWA AO,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",CHICHEWA,",",CHEWA,",.)

replace all_languages= subinstr(all_languages,",TCHEWA,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",TCHITCHEWA,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",SHI-TCHEUA,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",SHI-SHEWA,",",CHEWA,",.)



replace all_languages= subinstr(all_languages,",DAGAARE,",",DAGARI,",.)
replace all_languages= subinstr(all_languages,",DAGAARI,",",DAGARI,",.)
//replace all_languages= subinstr(all_languages,".DAGAARI,",",DAGARI,",.)
replace all_languages= subinstr(all_languages,",DAGAATI,",",DAGARI,",.)
replace all_languages= subinstr(all_languages,",DAGARA,",",DAGARI,",.)
replace all_languages= subinstr(all_languages,",DAGARE,",",DAGARI,",.)
replace all_languages= subinstr(all_languages,",DAGATE,",",DAGARI,",.)
//replace all_languages= subinstr(all_languages,"DAGATE",",DAGARI,",.)
replace all_languages= subinstr(all_languages,",DAGATI,",",DAGARI,",.)
replace all_languages= subinstr(all_languages,",DAGAUP,",",DAGARI,",.)
replace all_languages= subinstr(all_languages,",DANGARI,",",DAGARI,",.)



replace all_languages= subinstr(all_languages,",DAGB,",",DAGBANI,",.)
replace all_languages= subinstr(all_languages,",DAGBAMI,",",DAGBANI,",.)
replace all_languages= subinstr(all_languages,",DAGBANI.,",",DAGBANI,",.)

replace all_languages= subinstr(all_languages,",DAMA,",",DAMARA,",.)
replace all_languages= subinstr(all_languages,",DAMARARA,",",DAMARA,",.)


replace all_languages= subinstr(all_languages,",DANGBANI,",",DAGBANI,",.)

replace all_languages= subinstr(all_languages,",DANBGE,",",DANGBE,",.)


replace all_languages= subinstr(all_languages,",DANDI,",",DENDI,",.)

replace all_languages= subinstr(all_languages,",DIOL,",",DIOULA,",.)
replace all_languages= subinstr(all_languages,",DIOLA,",",DIOULA,",.)
//replace all_languages= subinstr(all_languages,"DIOLA",",DIOULA,",.)
replace all_languages= subinstr(all_languages,",DIOULE,",",DIOULA,",.)
replace all_languages= subinstr(all_languages,",DIOULA.FRANCAIS,",",DIOULA,",.)
replace all_languages= subinstr(all_languages,",DIOULMA,",",DIOULA,",.)
replace all_languages= subinstr(all_languages,",DIPLA,",",DIOULA,",.)
replace all_languages= subinstr(all_languages,",DJOULA,",",DIOULA,",.)

replace all_languages= subinstr(all_languages,",DITAMMARI,",",DITAMARI,",.)

replace all_languages= subinstr(all_languages,",DOGO,",",DOGON,",.)
replace all_languages= subinstr(all_languages,",DOG,",",DOGON,",.)
replace all_languages= subinstr(all_languages,",DOGOSSI,",",DOGON,",.)

replace all_languages= subinstr(all_languages,",EW,",",EWE,",.)
replace all_languages= subinstr(all_languages,",EVE,",",EWE,",.)
replace all_languages= subinstr(all_languages,",EWI,",",EWE,",.)

replace all_languages= subinstr(all_languages,",EFEKI,",",EFIK,",.)

replace all_languages= subinstr(all_languages,",EGGAN,",",EGGON,",.)
replace all_languages= subinstr(all_languages,",EGON,",",EGGON,",.)
replace all_languages= subinstr(all_languages,",EGUN,",",EGGON,",.)

replace all_languages= subinstr(all_languages,",EJAGHAM,",",EJAGAM,",.)



replace all_languages= subinstr(all_languages,",FANTI,",",FANTE,",.)
replace all_languages= subinstr(all_languages,",FANTLA,",",FANTE,",.)

replace all_languages= subinstr(all_languages,",EON,",",FON,",.)

replace all_languages= subinstr(all_languages,",FU,",",FULANI,",.)
replace all_languages= subinstr(all_languages,",FULA,",",FULANI,",.)
replace all_languages= subinstr(all_languages,",FUKA,",",FULANI,",.)
replace all_languages= subinstr(all_languages,",FULANI HAUSA,",",FULANI,",.)
replace all_languages= subinstr(all_languages,",FULATANLI,",",FULANI,",.)


replace all_languages= subinstr(all_languages,",FULF,",",FULFULDE,",.)
replace all_languages= subinstr(all_languages,",FULFU,",",FULFULDE,",.)
replace all_languages= subinstr(all_languages,",FULFUL,",",FULFULDE,",.)
replace all_languages= subinstr(all_languages,",FULFU,",",FULFULDE,",.)
replace all_languages= subinstr(all_languages,",FULFUDE,",",FULFULDE,",.)
//replace all_languages= subinstr(all_languages,"FULFUDE",",FULFULDE,",.)
replace all_languages= subinstr(all_languages,",FULS,",",FULFULDE,",.)
replace all_languages= subinstr(all_languages,",FULSE,",",FULFULDE,",.)
replace all_languages= subinstr(all_languages,",FULSE. FULFULDE,",",FULFULDE,",.)
replace all_languages= subinstr(all_languages,",FUTU,",",FULFULDE,",.)

replace all_languages= subinstr(all_languages,",GAA,",",GA,",.)

replace all_languages= subinstr(all_languages,",ABAGYI,",",GBAGYI,",.)
replace all_languages= subinstr(all_languages,",GBAH,",",GBAGYI,",.)

replace all_languages= subinstr(all_languages,",GBANDE,",",GBANDI,",.)

replace all_languages= subinstr(all_languages,",GOL,",",GOLA,",.)
replace all_languages= subinstr(all_languages,",GOAL,",",GOLA,",.)

replace all_languages= subinstr(all_languages,",GOIN,",",GOUN,",.)
replace all_languages= subinstr(all_languages,",GOUIN,",",GOUN,",.)


replace all_languages= subinstr(all_languages,",GOUROUNSSI,",",GOUROUNSI,",.)
replace all_languages= subinstr(all_languages,",GOUROUSI,",",GOUROUNSI,",.)
replace all_languages= subinstr(all_languages,",GOUROUSO,",",GOUROUNSI,",.)
replace all_languages= subinstr(all_languages,",GOUROUSSI,",",GOUROUNSI,",.)


replace all_languages= subinstr(all_languages,",GOURMANCHE,",",GOURMATCHE,",.)
replace all_languages= subinstr(all_languages,",GOURMACEMA,",",GOURMATCHE,",.)
replace all_languages= subinstr(all_languages,",GOURMATCHEMA,",",GOURMATCHE,",.)

replace all_languages= subinstr(all_languages,",GREGO,",",GREBO,",.)
replace all_languages= subinstr(all_languages,",GRE,",",GREBO,",.)


replace all_languages= subinstr(all_languages,",GULMACE,",",GULMACEMA,",.)
replace all_languages= subinstr(all_languages,",GULCEMA,",",GULMACEMA,",.)
replace all_languages= subinstr(all_languages,",GURUMA,",",GULMACEMA,",.)

replace all_languages= subinstr(all_languages,",HAOUSSA,",",HAUSA,",.)
replace all_languages= subinstr(all_languages,",HAOUSA,",",HAUSA,",.)
replace all_languages= subinstr(all_languages,",HAOU,",",HAUSA,",.)
replace all_languages= subinstr(all_languages,",HAUSA.,",",HAUSA,",.)
replace all_languages= subinstr(all_languages,",HAUSE,",",HAUSA,",.)
replace all_languages= subinstr(all_languages,",HHAUSA,",",HAUSA,",.)
replace all_languages= subinstr(all_languages,",HAUSA LANGUAGE,",",HAUSA,",.)
replace all_languages= subinstr(all_languages,",HAOUSSA,",",HAUSA,",.)

replace all_languages= subinstr(all_languages,",IBBIO,",",IBIBIO,",.)
replace all_languages= subinstr(all_languages,",IBANI,",",IBIBIO,",.)
replace all_languages= subinstr(all_languages,",IBIRA,",",IBIBIO,",.)
replace all_languages= subinstr(all_languages,",IBO,",",IBIBIO,",.)
replace all_languages= subinstr(all_languages,",IBO IKWERE,",",IBIBIO,",.)

replace all_languages= subinstr(all_languages,",HINDU,",",HINDI,",.)
replace all_languages= subinstr(all_languages,",INDIAN,",",HINDI,",.)
replace all_languages= subinstr(all_languages,"INDIAN",",HINDI,",.)


replace all_languages= subinstr(all_languages,",INGLES,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",INGLLES,",",ENGLISH,",.)


replace all_languages= subinstr(all_languages,",ITALIEN,",",ITALIAN,",.)
replace all_languages= subinstr(all_languages,",ITALIANO,",",ITALIAN,",.)


replace all_languages= subinstr(all_languages,",ITALIEN,",",ITALIAN,",.)

replace all_languages= subinstr(all_languages,",ISIXHOZA,",",ISIXHOSA,",.)
replace all_languages= subinstr(all_languages,",ISIZHOZA,",",ISIXHOSA,",.)
replace all_languages= subinstr(all_languages,",IXHOSA,",",ISIXHOSA,",.)

replace all_languages= subinstr(all_languages,",ISI ZULU,",",ISIZULU,",.)
replace all_languages= subinstr(all_languages,",ISUZULU,",",ISIZULU,",.)

replace all_languages= subinstr(all_languages,",ISESOTH,",",SESOTHO,",.)
replace all_languages= subinstr(all_languages,",ISISOTHO,",",SESOTHO,",.)
replace all_languages= subinstr(all_languages,",ISSOTHO,",",SESOTHO,",.)

replace all_languages= subinstr(all_languages,",JUKUM,",",JUKUN,",.)
replace all_languages= subinstr(all_languages,",JUKUN DONGA,",",JUKUN,",.)

replace all_languages= subinstr(all_languages,",KISWAHIL,",",KISWAHILI,",.)
replace all_languages= subinstr(all_languages,",KISWAHIKI,",",KISWAHILI,",.)
replace all_languages= subinstr(all_languages,",KISWAHIIL,",",KISWAHILI,",.)
replace all_languages= subinstr(all_languages,",KISWAHII,",",KISWAHILI,",.)
replace all_languages= subinstr(all_languages,",KISWAHILII,",",KISWAHILI,",.)
replace all_languages= subinstr(all_languages,",KISWAHILLI,",",KISWAHILI,",.)
replace all_languages= subinstr(all_languages,",KISWAHLI,",",KISWAHILI,",.)
replace all_languages= subinstr(all_languages,",KISWALI,",",KISWAHILI,",.)
replace all_languages= subinstr(all_languages,",KISWHAHILI,",",KISWAHILI,",.)
replace all_languages= subinstr(all_languages,",KISWHAILI,",",KISWAHILI,",.)
replace all_languages= subinstr(all_languages,",KISWHILI,",",KISWAHILI,",.)
replace all_languages= subinstr(all_languages,",KIWAHILI,",",KISWAHILI,",.)
replace all_languages= subinstr(all_languages,",KISAWHILI,",",KISWAHILI,",.)
replace all_languages= subinstr(all_languages,",KISWAFWA,",",KISWAHILI,",.)
replace all_languages= subinstr(all_languages,",KIWHILI,",",KISWAHILI,",.)



replace all_languages= subinstr(all_languages,",KISUKUKMA,",",KISUKUMA,",.)

replace all_languages= subinstr(all_languages,",KALABAR,",",KALABARI,",.)
replace all_languages= subinstr(all_languages,",KALABAN,",",KALABARI,",.)
replace all_languages= subinstr(all_languages,",KAILALERI,",",KALABARI,",.)

replace all_languages= subinstr(all_languages,",KALE,",",KALENJIN,",.)
replace all_languages= subinstr(all_languages,",KALANGA,",",KALENJIN,",.)
replace all_languages= subinstr(all_languages,",KAKENJIN,",",KALENJIN,",.)

replace all_languages= subinstr(all_languages,",KAMBU,",",KAMBA,",.)
replace all_languages= subinstr(all_languages,",KAMU,",",KAMBA,",.)

replace all_languages= subinstr(all_languages,",KAMBIRI,",",KAMBARI,",.)

replace all_languages= subinstr(all_languages,",KASEN,",",KASEM,",.)
replace all_languages= subinstr(all_languages,",KASENA,",",KASEM,",.)
replace all_languages= subinstr(all_languages,",KASIM,",",KASEM,",.)
replace all_languages= subinstr(all_languages,",KASIM+C1100,",",KASEM,",.)
replace all_languages= subinstr(all_languages,",KASINA,",",KASEM,",.)
replace all_languages= subinstr(all_languages,",KASSIM,",",KASEM,",.)

replace all_languages= subinstr(all_languages,",KAREKARE,",",KARI-KARI,",.)
replace all_languages= subinstr(all_languages,",KARI-KAR,",",KARI-KARI,",.)
replace all_languages= subinstr(all_languages,",KARIKARI,",",KARI-KARI,",.)
replace all_languages= subinstr(all_languages,",KEREKARE,",",KARI-KARI,",.)

replace all_languages= subinstr(all_languages,",KATAF (ATYAP),",",KATAF,",.)
replace all_languages= subinstr(all_languages,",KATAF(ATYAP),",",KATAF,",.)




replace all_languages= subinstr(all_languages,",KIKURYA,",",KIKUYU,",.)
replace all_languages= subinstr(all_languages,",KIKOKO,",",KIKUYU,",.)
replace all_languages= subinstr(all_languages,",KIKIYU,",",KIKUYU,",.)
replace all_languages= subinstr(all_languages,",KIKUYYU,",",KIKUYU,",.)



replace all_languages= subinstr(all_languages,",KIMAK0NDE,",",KIMAKONDE,",.)

replace all_languages= subinstr(all_languages,",KIMARAI,",",KIMASAI,",.)

replace all_languages= subinstr(all_languages,",KINDALO,",",KINDALI,",.)

replace all_languages= subinstr(all_languages,",KINDENDELEKO,",",KINDENDEULE,",.)
replace all_languages= subinstr(all_languages,",KINDEBGEREKO,",",KINDENDEULE,",.)
replace all_languages= subinstr(all_languages,",KINDENGEREKO,",",KINDENDEULE,",.)


replace all_languages= subinstr(all_languages,",KINYAKYU,",",KINYAKYUSA,",.)
replace all_languages= subinstr(all_languages,",KINYAKUSA,",",KINYAKYUSA,",.)
replace all_languages= subinstr(all_languages,",KINYAKISA,",",KINYAKYUSA,",.)


replace all_languages= subinstr(all_languages,",KINYAMBU,",",KINYAMBO,",.)


replace all_languages= subinstr(all_languages,",KINYAMWZI,",",KINYAMWEZI,",.)

replace all_languages= subinstr(all_languages,",KINYAMWZI,",",KINYAMWEZI,",.)
replace all_languages= subinstr(all_languages,",KINYAMWZI,",",KINYAMWEZI,",.)


replace all_languages= subinstr(all_languages,",KISSI,",",KISII,",.)
//replace all_languages= subinstr(all_languages,"KISSI",",KISII,",.)
replace all_languages= subinstr(all_languages,",KIS,",",KISII,",.)


replace all_languages= subinstr(all_languages,",KISAMBWA,",",KISAMBAA,",.)
replace all_languages= subinstr(all_languages,",KISUMBWE,",",KISAMBAA,",.)
replace all_languages= subinstr(all_languages,",KISUMBWA,",",KISAMBAA,",.)
replace all_languages= subinstr(all_languages,",KISUBA,",",KISAMBAA,",.)
replace all_languages= subinstr(all_languages,",KISUBI,",",KISAMBAA,",.)
replace all_languages= subinstr(all_languages,",KISUMBWI,",",KISAMBAA,",.)
replace all_languages= subinstr(all_languages,",KISHUBI,",",KISAMBAA,",.)


replace all_languages= subinstr(all_languages,",KOKOMBA,",",KOKONBA,",.)
replace all_languages= subinstr(all_languages,",KONKOBA,",",KOKONBA,",.)
replace all_languages= subinstr(all_languages,",KONKOMBA,",",KOKONBA,",.)
replace all_languages= subinstr(all_languages,",KONKONBA,",",KOKONBA,",.)

replace all_languages= subinstr(all_languages,",KOTOKLI,",",KOTOKOLI,",.)

replace all_languages= subinstr(all_languages,",KPELLE MANO,",",KPELLE,",.)
replace all_languages= subinstr(all_languages,",KPELLEH,",",KPELLE,",.)

replace all_languages= subinstr(all_languages,",LUYALE,",",LUVALE,",.)
replace all_languages= subinstr(all_languages,",LYELE,",",LUVALE,",.)

replace all_languages= subinstr(all_languages,",LUSAMI,",",LUSAMIA,",.)


replace all_languages= subinstr(all_languages,",MENDI,",",MENDE,",.)

replace all_languages= subinstr(all_languages,",MANGA,",",MANG'ANJA,",.)
replace all_languages= subinstr(all_languages,",MANGA'ANJA,",",MANG'ANJA,",.)
replace all_languages= subinstr(all_languages,",MANGA'NJA,",",MANG'ANJA,",.)


replace all_languages= subinstr(all_languages,",MANDINGUE,",",MANDINGO,",.)
replace all_languages= subinstr(all_languages,",MANDING,",",MANDINGO,",.)
replace all_languages= subinstr(all_languages,",MANDIGO,",",MANDINGO,",.)


replace all_languages= subinstr(all_languages,",MANDINK,",",MANDINKA,",.)
replace all_languages= subinstr(all_languages,",MANDIKA,",",MANDINKA,",.)


replace all_languages= subinstr(all_languages,",MAMPRULI,",",MAMPRUSI,",.)
replace all_languages= subinstr(all_languages,",MAMPRILI,",",MAMPRUSI,",.)

replace all_languages= subinstr(all_languages,",MALIN,",",MALINKE,",.)


replace all_languages= subinstr(all_languages,",MAKWE,",",MAKUA,",.)
replace all_languages= subinstr(all_languages,",MAJUA,",",MAKUA,",.)
replace all_languages= subinstr(all_languages,",MACUA,",",MAKUA,",.)
replace all_languages= subinstr(all_languages,",MACHEUA,",",MAKUA,",.)
replace all_languages= subinstr(all_languages,",MALGASY,",",MALAGASY,",.)



replace all_languages= subinstr(all_languages,",MBUMDA,",",MBUNDA,",.)
replace all_languages= subinstr(all_languages,",MBUNDU,",",MBUNDA,",.)
replace all_languages= subinstr(all_languages,",MBUMDA,",",MBUNDA,",.)
replace all_languages= subinstr(all_languages,",MBONDA,",",MBUNDA,",.)


replace all_languages= subinstr(all_languages,",MORE,",",MOORE,",.)
replace all_languages= subinstr(all_languages,",MOOR,",",MOORE,",.)
replace all_languages= subinstr(all_languages,",MOOE,",",MOORE,",.)
replace all_languages= subinstr(all_languages,",MMORE,",",MOORE,",.)

replace all_languages= subinstr(all_languages,",MUMYE,",",MUMUYE,",.)

replace all_languages= subinstr(all_languages,",MOSHIYI,",",MOSSI,",.)
replace all_languages= subinstr(all_languages,",MOSHIE,",",MOSSI,",.)
replace all_languages= subinstr(all_languages,",MOSHE,",",MOSSI,",.)





replace all_languages= subinstr(all_languages,",NAMBIYA,",",NAMBYA,",.)
replace all_languages= subinstr(all_languages,",NAMBIA,",",NAMBYA,",.)



replace all_languages= subinstr(all_languages,",NDBELE,",",NDEBELE,",.)
replace all_languages= subinstr(all_languages,",NDEDELE,",",NDEBELE,",.)
replace all_languages= subinstr(all_languages,",NDABELE,",",NDEBELE,",.)


replace all_languages= subinstr(all_languages,",NHUNGUWE,",",NHUNGUE,",.)
replace all_languages= subinstr(all_languages,",NHUNGUWE,",",NHUNGUE,",.)
replace all_languages= subinstr(all_languages,",NHUNGWE,",",NHUNGUE,",.)


replace all_languages= subinstr(all_languages,",NKHOYA,",",NKOYA,",.)

replace all_languages= subinstr(all_languages,",NENBE,",",NEMBE,",.)

replace all_languages= subinstr(all_languages,",NDONI,",",NGONI,",.)


replace all_languages= subinstr(all_languages,",NYIGHA,",",NYIKA,",.)

replace all_languages= subinstr(all_languages,",NYUMBEM,",",NYEMBA,",.)

replace all_languages= subinstr(all_languages,",NYANTA,",",NYANJA,",.)
replace all_languages= subinstr(all_languages,",NYANGA,",",NYANJA,",.)
replace all_languages= subinstr(all_languages,",NYAJA,",",NYANJA,",.)
replace all_languages= subinstr(all_languages,",NYAAJA,",",NYANJA,",.)
replace all_languages= subinstr(all_languages,",NVANJA,",",NYANJA,",.)
replace all_languages= subinstr(all_languages,",NJANJA,",",NYANJA,",.)
replace all_languages= subinstr(all_languages,",NHANJA,",",NYANJA,",.)
replace all_languages= subinstr(all_languages,",MYANJA,",",NYANJA,",.)



replace all_languages= subinstr(all_languages,",NYUGUE,",",NYUNGUE,",.)
replace all_languages= subinstr(all_languages,",NYUBGUE,",",NYUNGUE,",.)


replace all_languages= subinstr(all_languages,",OKRIKA,",",OKIRIKA,",.)
replace all_languages= subinstr(all_languages,",OLARIKA,",",OKIRIKA,",.)
replace all_languages= subinstr(all_languages,",OHIKA,",",OKIRIKA,",.)

replace all_languages= subinstr(all_languages,",OSHIWAMB,",",OSHIWAMBO,",.)
replace all_languages= subinstr(all_languages,",OSHIWAM,",",OSHIWAMBO,",.)
replace all_languages= subinstr(all_languages,",OSHIW,",",OSHIWAMBO,",.)
replace all_languages= subinstr(all_languages,",OSHIVALE,",",OSHIWAMBO,",.)


replace all_languages= subinstr(all_languages,",OTAMANI,",",OTAMARI,",.)

replace all_languages= subinstr(all_languages,",OTJIIHERERO,",",OTJIHERERO,",.)
replace all_languages= subinstr(all_languages,",OTJIHEREHO,",",OTJIHERERO,",.)
replace all_languages= subinstr(all_languages,",OTJIHERE,",",OTJIHERERO,",.)
replace all_languages= subinstr(all_languages,",OTJIHE,",",OTJIHERERO,",.)
replace all_languages= subinstr(all_languages,",OTJHERERO,",",OTJIHERERO,",.)
replace all_languages= subinstr(all_languages,",OTHIHERERO,",",OTJIHERERO,",.)


replace all_languages= subinstr(all_languages,",PELI,",",PEDI,",.)

replace all_languages= subinstr(all_languages,",PEUL,",",FULANI,",.)
replace all_languages= subinstr(all_languages,"PEULH",",FULANI,",.)


replace all_languages= subinstr(all_languages,",PIGIN,",",PIDGIN,",.)
replace all_languages= subinstr(all_languages,",PIDIGIN,",",PIDGIN,",.)
replace all_languages= subinstr(all_languages,",PIDGUN,",",PIDGIN,",.)

replace all_languages= subinstr(all_languages,",PIDGEN ENGLISH,",",PIDGIN ENGLISH,",.)
replace all_languages= subinstr(all_languages,",PIDGIN-ENGLISH,",",PIDGIN,",.)
replace all_languages= subinstr(all_languages,",PIDGINENGLISH,",",PIDGIN,",.)
replace all_languages= subinstr(all_languages,",PIGIN ENGLISH,",",PIDGIN,",.)
replace all_languages= subinstr(all_languages,",PIGINENGLISH,",",PIDGIN,",.)


replace all_languages= subinstr(all_languages,",PO,",",POKOT,",.)
replace all_languages= subinstr(all_languages,",POKOMO,",",POKOT,",.)



replace all_languages= subinstr(all_languages,",PPORTUGUES,",",PORTUGUESE,",.)
replace all_languages= subinstr(all_languages,",POTUGUES,",",PORTUGUESE,",.)
replace all_languages= subinstr(all_languages,",PORTUQUESE,",",PORTUGUESE,",.)
replace all_languages= subinstr(all_languages,",PORTUGUES3,",",PORTUGUESE,",.)
replace all_languages= subinstr(all_languages,",PORTUGUES,",",PORTUGUESE,",.)
replace all_languages= subinstr(all_languages,",PORTUGUEESE,",",PORTUGUESE,",.)
replace all_languages= subinstr(all_languages,",PORTUGUEES,",",PORTUGUESE,",.)
replace all_languages= subinstr(all_languages,",PORTUGUE,",",PORTUGUESE,",.)
replace all_languages= subinstr(all_languages,",PORTUGU,",",PORTUGUESE,",.)
replace all_languages= subinstr(all_languages,",PORTUGESE,",",PORTUGUESE,",.)
replace all_languages= subinstr(all_languages,",PORTUGES,",",PORTUGUESE,",.)
replace all_languages= subinstr(all_languages,",PORTUGEESE,",",PORTUGUESE,",.)
replace all_languages= subinstr(all_languages,",PORTUGAIS,",",PORTUGUESE,",.)
replace all_languages= subinstr(all_languages,",PORTRUGUES,",",PORTUGUESE,",.)
replace all_languages= subinstr(all_languages,",PORTGUES,",",PORTUGUESE,",.)
replace all_languages= subinstr(all_languages,",P0RTUGUES,",",PORTUGUESE,",.)


replace all_languages= subinstr(all_languages,",PLAAR,",",PULAAR,",.)
replace all_languages= subinstr(all_languages,",PULAR,",",PULAAR,",.)
replace all_languages= subinstr(all_languages,",PULAAAR,",",PULAAR,",.)


replace all_languages= subinstr(all_languages,",RUKHONJO,",",RUKAVANGO,",.)
replace all_languages= subinstr(all_languages,",RUKAVAN,",",RUKAVANGO,",.)

replace all_languages= subinstr(all_languages,",RUKWANGALII,",",RUKWANGALI,",.)


replace all_languages= subinstr(all_languages,",RUNYOR,",",RUNYORO,",.)
replace all_languages= subinstr(all_languages,",RUNYOLO,",",RUNYORO,",.)
replace all_languages= subinstr(all_languages,",RUNYARW,",",RUNYORO,",.)



replace all_languages= subinstr(all_languages,",RUTOOTO,",",RUTOORO,",.)
replace all_languages= subinstr(all_languages,",ROTOORO,",",RUTOORO,",.)


replace all_languages= subinstr(all_languages,",SAPO,",",SARPO,",.)

replace all_languages= subinstr(all_languages,",SAPO,",",SARPO,",.)

replace all_languages= subinstr(all_languages,",SEMBUMKUSHU,",",SEMBUKUSHU,",.)

replace all_languages= subinstr(all_languages,",SEMBUMKUSHU,",",SEMBUKUSHU,",.)

replace all_languages= subinstr(all_languages,",SEKOBA,",",SEKHOOA,",.)

replace all_languages= subinstr(all_languages,",SARAKHOLE,",",SARAKOLLE,",.)
replace all_languages= subinstr(all_languages,",SARAKO,",",SARAKOLLE,",.)
replace all_languages= subinstr(all_languages,",SARAKOLL,",",SARAKOLLE,",.)


replace all_languages= subinstr(all_languages,",SEFE,",",SEFWI,",.)

replace all_languages= subinstr(all_languages,",SEANA,",",SENA,",.)
replace all_languages= subinstr(all_languages,",SENE,",",SENA,",.)
replace all_languages= subinstr(all_languages,",SENAYAO,",",SENA,",.)
replace all_languages= subinstr(all_languages,",SENAJWA,",",SENA,",.)


replace all_languages= subinstr(all_languages,",SEDIRIKWA,",",SEBIRWA,",.)


replace all_languages= subinstr(all_languages,",SEKALAGADI,",",SEKGALAGADI,",.)


replace all_languages= subinstr(all_languages,",SEKALNGA,",",SEKALANGA,",.)
replace all_languages= subinstr(all_languages,",SEKGALAG,",",SEKALANGA,",.)



replace all_languages= subinstr(all_languages,",SENOUFOU,",",SENOUFO,",.)
replace all_languages= subinstr(all_languages,",SENOUFO,",",SENOUFO,",.)


replace all_languages= subinstr(all_languages,",SESOBEYA,",",SESUBIA,",.)
replace all_languages= subinstr(all_languages,",SUBIA,",",SESUBIA,",.)


replace all_languages= subinstr(all_languages,",SETOBOLE,",",SETEBELE,",.)


replace all_languages= subinstr(all_languages,",SESTHO,",",SESOTHO,",.)
replace all_languages= subinstr(all_languages,",SESOHTO,",",SESOTHO,",.)
replace all_languages= subinstr(all_languages,",SESETHO,",",SESOTHO,",.)

replace all_languages= subinstr(all_languages,",SERE,",",SERER,",.)

replace all_languages= subinstr(all_languages,",SESHONA,",",SHONA,",.)


replace all_languages= subinstr(all_languages,",SETHUPU,",",SETHEPU,",.)


replace all_languages= subinstr(all_languages,",SEYEYI,",",SEYEI,",.)
replace all_languages= subinstr(all_languages,",SIYEYI,",",SEYEI,",.)



replace all_languages= subinstr(all_languages,",SHAGAAN,",",SHANGAAN,",.)
replace all_languages= subinstr(all_languages,",SHANGAN,",",SHANGAAN,",.)
replace all_languages= subinstr(all_languages,",SHANGANA,",",SHANGAAN,",.)
replace all_languages= subinstr(all_languages,",SHANGANI,",",SHANGAAN,",.)
replace all_languages= subinstr(all_languages,",SHONGON,",",SHANGAAN,",.)
replace all_languages= subinstr(all_languages,",TSHANGANE,",",SHANGAAN,",.)
replace all_languages= subinstr(all_languages,",TSHANGWE,",",SHANGAAN,",.)
replace all_languages= subinstr(all_languages,",SESHANGANA,",",SHANGAAN,",.)
replace all_languages= subinstr(all_languages,",SESHANGANI,",",SHANGAAN,",.)

replace all_languages= subinstr(all_languages,",SETSWAN,",",SETSWANA,",.)
replace all_languages= subinstr(all_languages,",SETSW,",",SETSWANA,",.)
replace all_languages= subinstr(all_languages,",SETSWANG,",",SETSWANA,",.)
replace all_languages= subinstr(all_languages,",SETWANA,",",SETSWANA,",.)
replace all_languages= subinstr(all_languages,",SETSOANA,",",SETSWANA,",.)
replace all_languages= subinstr(all_languages,",SESTWANA,",",SETSWANA,",.)
replace all_languages= subinstr(all_languages,",SETSWAN,",",SETSWANA,",.)
replace all_languages= subinstr(all_languages,",SETSWAN,",",SETSWANA,",.)
replace all_languages= subinstr(all_languages,",SETSWAN,",",SETSWANA,",.)


replace all_languages= subinstr(all_languages,",SHUW,",",SHUWA,",.)
replace all_languages= subinstr(all_languages,",SHUWA HAUSA,",",SHUWA,",.)


replace all_languages= subinstr(all_languages,",SILOZE,",",SILOZI,",.)


replace all_languages= subinstr(all_languages,",SISALA,",",SISILA,",.)
replace all_languages= subinstr(all_languages,",SISALI,",",SISILA,",.)
replace all_languages= subinstr(all_languages,",SISELA,",",SISILA,",.)
replace all_languages= subinstr(all_languages,",SISSABA,",",SISILA,",.)
replace all_languages= subinstr(all_languages,",SISSALA,",",SISILA,",.)
replace all_languages= subinstr(all_languages,",SISSALI,",",SISILA,",.)


replace all_languages= subinstr(all_languages,",SOMALII,",",SOMALI,",.)


replace all_languages= subinstr(all_languages,",SONI,",",SONINKE,",.)

replace all_languages= subinstr(all_languages,",SONRAI,",",SONRHAI,",.)
replace all_languages= subinstr(all_languages,",SONRA,",",SONRHAI,",.)


replace all_languages= subinstr(all_languages,",SOSSO,",",SOTHO,",.)
replace all_languages= subinstr(all_languages,",SOTHOI,",",SOTHO,",.)
replace all_languages= subinstr(all_languages,",SUTU,",",SOTHO,",.)
replace all_languages= subinstr(all_languages,",SUTHU,",",SOTHO,",.)
replace all_languages= subinstr(all_languages,",SISUTHU,",",SOTHO,",.)
replace all_languages= subinstr(all_languages,",SOUTH,",",SOTHO,",.)
replace all_languages= subinstr(all_languages,",SOUTHERN SOTHO,",",SOTHO,",.)
replace all_languages= subinstr(all_languages,",SOUSOU,",",SOTHO,",.)
replace all_languages= subinstr(all_languages,",SOWETO,",",SOTHO,",.)
replace all_languages= subinstr(all_languages,",SOUTH SOTHO,",",SOTHO,",.)
replace all_languages= subinstr(all_languages,"SOUTH SOTHO",",SOTHO,",.)
replace all_languages= subinstr(all_languages,",SETSOTHO,",",SOTHO,",.)


replace all_languages= subinstr(all_languages,",SIPEDI,",",SEPEDI,",.)
replace all_languages= subinstr(all_languages,",SPEDI,",",SEPEDI,",.)
replace all_languages= subinstr(all_languages,",SEPELI,",",SEPEDI,",.)
replace all_languages= subinstr(all_languages,",SIPEDI,",",SEPEDI,",.)

replace all_languages= subinstr(all_languages,",SUAHILE,",",SWAHILI,",.)
replace all_languages= subinstr(all_languages,",SUAHILI,",",SWAHILI,",.)
replace all_languages= subinstr(all_languages,",SUAILE,",",SWAHILI,",.)
replace all_languages= subinstr(all_languages,",SWAHII,",",SWAHILI,",.)
replace all_languages= subinstr(all_languages,",SWAHIL,",",SWAHILI,",.)
replace all_languages= subinstr(all_languages,",SWAHILIL,",",SWAHILI,",.)
replace all_languages= subinstr(all_languages,",SWAILI,",",SWAHILI,",.)
replace all_languages= subinstr(all_languages,",SWALI,",",SWAHILI,",.)
replace all_languages= subinstr(all_languages,",SWHAILI,",",SWAHILI,",.)


replace all_languages= subinstr(all_languages,",SISWATI,",",SWAZI,",.)
replace all_languages= subinstr(all_languages,",SESWATI,",",SWAZI,",.)
replace all_languages= subinstr(all_languages,",SWOTI,",",SWAZI,",.)
replace all_languages= subinstr(all_languages,",SWATI,",",SWAZI,",.)
replace all_languages= subinstr(all_languages,",SWAZU,",",SWAZI,",.)
replace all_languages= subinstr(all_languages,",SWAZI A,",",SWAZI,",.)
replace all_languages= subinstr(all_languages,",SISWAZI,",",SWAZI,",.)


replace all_languages= subinstr(all_languages,",TAMACHEK,",",TAMASHEQ,",.)
replace all_languages= subinstr(all_languages,",TAMACHECK,",",TAMASHEQ,",.)


replace all_languages= subinstr(all_languages,",TEWE,",",TIV,",.)

replace all_languages= subinstr(all_languages,",THIMBUK,",",THIMBUKUSHU,",.)


replace all_languages= subinstr(all_languages,",TONGO,",",TONGA,",.)
replace all_languages= subinstr(all_languages,",TONGA CHEWA,",",TONGA,",.)
replace all_languages= subinstr(all_languages,",TONAA,",",TONGA,",.)
replace all_languages= subinstr(all_languages,",TOMGA,",",TONGA,",.)
replace all_languages= subinstr(all_languages,",SETSONGA,",",TONGA,",.)


replace all_languages= subinstr(all_languages,",TOURKA,",",TOUCOULEUR,",.)
replace all_languages= subinstr(all_languages,",TOKA,",",TOUCOULEUR,",.)
replace all_languages= subinstr(all_languages,",TOKALEYA,",",TOUCOULEUR,",.)
replace all_languages= subinstr(all_languages,"TOKALEYA",",TOUCOULEUR,",.)



replace all_languages= subinstr(all_languages,",TSONGO,",",TSONGA,",.)
replace all_languages= subinstr(all_languages,",TSOANA,",",TSONGA,",.)
replace all_languages= subinstr(all_languages,",TSITSONGA,",",TSONGA,",.)
replace all_languages= subinstr(all_languages,",TSHONGA,",",TSONGA,",.)
replace all_languages= subinstr(all_languages,",TSENGA,",",TSONGA,",.)
replace all_languages= subinstr(all_languages,",TSENGA,",",TSONGA,",.)
replace all_languages= subinstr(all_languages,",SITSONGA,",",TSONGA,",.)
replace all_languages= subinstr(all_languages,",XITSONGA,",",TSONGA,",.)


replace all_languages= subinstr(all_languages,",SOTSWANA,",",TSWANA,",.)
replace all_languages= subinstr(all_languages,",STWANA,",",TSWANA,",.)
replace all_languages= subinstr(all_languages,",SWANA,",",TSWANA,",.)
replace all_languages= subinstr(all_languages,",TSWANI,",",TSWANA,",.)
replace all_languages= subinstr(all_languages,",TSHWANA,",",TSWANA,",.)
replace all_languages= subinstr(all_languages,",TSWANE,",",TSWANA,",.)
replace all_languages= subinstr(all_languages,",TSWANE,",",TSWANA,",.)
replace all_languages= subinstr(all_languages,",TSHWANA,",",TSWANA,",.)
replace all_languages= subinstr(all_languages,",TSAWANA,",",TSWANA,",.)
replace all_languages= subinstr(all_languages,",TS,",",TSWANA,",.)
replace all_languages= subinstr(all_languages,",SITSWANA,",",TSWANA,",.)
replace all_languages= subinstr(all_languages,",SESW,",",SETSWANA,",.)



replace all_languages= subinstr(all_languages,",TWI(AKAN),",",TWI,",.)


replace all_languages= subinstr(all_languages,",UMBUKA,",",TUMBUKA,",.)
replace all_languages= subinstr(all_languages,",TUMBU,",",TUMBUKA,",.)
replace all_languages= subinstr(all_languages,",TUBUKA,",",TUMBUKA,",.)
replace all_languages= subinstr(all_languages,",TUMBUKA CHICHEWA,",",TUMBUKA,",.)


replace all_languages= subinstr(all_languages,",TWANA,",",TURKANA,",.)
replace all_languages= subinstr(all_languages,",TURKAN,",",TURKANA,",.)
replace all_languages= subinstr(all_languages,",TURKA,",",TURKANA,",.)
replace all_languages= subinstr(all_languages,"TURKA",",TURKANA,",.)


replace all_languages= subinstr(all_languages,",UROBO,",",URHOBO,",.)

replace all_languages= subinstr(all_languages,",WAALE,",",WAALA,",.)
replace all_languages= subinstr(all_languages,",WAJA,",",WAALA,",.)
replace all_languages= subinstr(all_languages,",WALA,",",WAALA,",.)
replace all_languages= subinstr(all_languages,",WALE,",",WAALA,",.)
replace all_languages= subinstr(all_languages,",YALA,",",WAALA,",.)


replace all_languages= subinstr(all_languages,",VIA,",",VAI,",.)


replace all_languages= subinstr(all_languages,",VEND,",",VENDA,",.)
replace all_languages= subinstr(all_languages,",VEMBA,",",VENDA,",.)
replace all_languages= subinstr(all_languages,",VHENDA,",",VENDA,",.)
replace all_languages= subinstr(all_languages,",WEMBA,",",VENDA,",.)


replace all_languages= subinstr(all_languages,",WIZA,",",WASSA,",.)
replace all_languages= subinstr(all_languages,",WHESA,",",WASSA,",.)


replace all_languages= subinstr(all_languages,",WOOLOF,",",WOLOF,",.)
replace all_languages= subinstr(all_languages,",WOLOLOF,",",WOLOF,",.)
replace all_languages= subinstr(all_languages,",WOLOF WOLOF,",",WOLOF,",.)
replace all_languages= subinstr(all_languages,",WOLO,",",WOLOF,",.)
replace all_languages= subinstr(all_languages,",WOLLOF,",",WOLOF,",.)
replace all_languages= subinstr(all_languages,",WOLF,",",WOLOF,",.)
replace all_languages= subinstr(all_languages,",WLOF,",",WOLOF,",.)


replace all_languages= subinstr(all_languages,",XSHONGA,",",XITSONGA,",.)


replace all_languages= subinstr(all_languages,",XH,",",XHOSA,",.)
replace all_languages= subinstr(all_languages,",XHOSA ONLY,",",XHOSA,",.)
replace all_languages= subinstr(all_languages,",XHOUZA,",",XHOSA,",.)
replace all_languages= subinstr(all_languages,",XHOZA,",",XHOSA,",.)
replace all_languages= subinstr(all_languages,",SIZHOSA,",",XHOSA,",.)
replace all_languages= subinstr(all_languages,",SIXHOSA,",",XHOSA,",.)
replace all_languages= subinstr(all_languages,",SEXHOZA,",",XHOSA,",.)
replace all_languages= subinstr(all_languages,",SEXHOVZA,",",XHOSA,",.)
replace all_languages= subinstr(all_languages,",SEXHOUZA,",",XHOSA,",.)
replace all_languages= subinstr(all_languages,",SEXHOSA,",",XHOSA,",.)
replace all_languages= subinstr(all_languages,",SEXHOAZA,",",XHOSA,",.)
replace all_languages= subinstr(all_languages,",SEXHAUZA,",",XHOSA,",.)
replace all_languages= subinstr(all_languages,",SEXH,",",XHOSA,",.)
replace all_languages= subinstr(all_languages,",SEQHOZA,",",XHOSA,",.)


replace all_languages= subinstr(all_languages,",XITSUA,",",XITSWA,",.)
replace all_languages= subinstr(all_languages,",XITSAU,",",XITSWA,",.)
replace all_languages= subinstr(all_languages,",XITEU,",",XITSWA,",.)
replace all_languages= subinstr(all_languages,",XISUAZI,",",XITSWA,",.)
replace all_languages= subinstr(all_languages,",XIITSWA,",",XITSWA,",.)


replace all_languages= subinstr(all_languages,",YOA,",",YAO,",.)
replace all_languages= subinstr(all_languages,"YOA",",YAO,",.)
replace all_languages= subinstr(all_languages,",YAWO,",",YAO,",.)
replace all_languages= subinstr(all_languages,",YAO CHEWA,",",YAO,",.)
replace all_languages= subinstr(all_languages,",YARGA,",",YAO,",.)
replace all_languages= subinstr(all_languages,",YAHO(CHAWA),",",YAO,",.)

replace all_languages= subinstr(all_languages,",YANANA,",",YANAN,",.)
replace all_languages= subinstr(all_languages,",XANGANA,",",YANAN,",.)


replace all_languages= subinstr(all_languages,",YPRUBA,",",YORUBA,",.)
replace all_languages= subinstr(all_languages,",YORYBA,",",YORUBA,",.)
replace all_languages= subinstr(all_languages,",YORUBA(EGUN),",",YORUBA,",.)
replace all_languages= subinstr(all_languages,",YOROUBA,",",YORUBA,",.)

replace all_languages= subinstr(all_languages,",SIZULU,",",ZULU,",.)
replace all_languages= subinstr(all_languages,",ZOORE,",",ZULU,",.)
replace all_languages= subinstr(all_languages,",ZOSSE,",",ZULU,",.)
replace all_languages= subinstr(all_languages,",XULU,",",ZULU,",.)
replace all_languages= subinstr(all_languages,",ZEZULU,",",ZULU,",.)
replace all_languages= subinstr(all_languages,",ZEZURU,",",ZULU,",.)
replace all_languages= subinstr(all_languages,",ZUGU,",",ZULU,",.)
replace all_languages= subinstr(all_languages,",ZULO,",",ZULU,",.)
replace all_languages= subinstr(all_languages,",ZULU S,",",ZULU,",.)
replace all_languages= subinstr(all_languages,",ZURU,",",ZULU,",.)
replace all_languages= subinstr(all_languages,",SEZULU,",",ZULU,",.)
*replace all_languages= subinstr(all_languages,"SEZULU",",ZULU,",.)
replace all_languages= subinstr(all_languages,",SEZEZURU,",",ZULU,",.)
*replace all_languages= subinstr(all_languages,"SEZEZURU",",ZULU,",.)

replace all_languages= subinstr(all_languages,",ALEMA,",",GERMAN,",.)
replace all_languages= subinstr(all_languages,",ALEMAO,",",GERMAN,",.)
replace all_languages= subinstr(all_languages,",ALLEMAND,",",GERMAN,",.)
replace all_languages= subinstr(all_languages,",ARABE,",",ARABIC,",.)
replace all_languages= subinstr(all_languages,",ARABO,",",ARABIC,",.)
replace all_languages= subinstr(all_languages,",ARAGO,",",ARABIC,",.)
replace all_languages= subinstr(all_languages,",BIRFUO,",",BIRIFOR,",.)
replace all_languages= subinstr(all_languages,",BIROM,",",BIROMI,",.)
replace all_languages= subinstr(all_languages,",BISA,",",BISSA,",.)
replace all_languages= subinstr(all_languages,",BITINGA,",",BITONGA,",.)
replace all_languages= subinstr(all_languages,",BRASA,",",BRASS,",.)
replace all_languages= subinstr(all_languages,",BRIFO,",",BREFO,",.)
replace all_languages= subinstr(all_languages,",BRUSA,",",BROSA,",.)
replace all_languages= subinstr(all_languages,",BUZANGA,",",BUSANGA,",.)
replace all_languages= subinstr(all_languages,",CASTELIANO,",",SPANISH,",.)
replace all_languages= subinstr(all_languages,",CASTELIANO,",",SPANISH,",.)
replace all_languages= subinstr(all_languages,",CHICHWA,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",CHIKHOKHOLA,",",KHOKHOLA,",.)
replace all_languages= subinstr(all_languages,",CHIKOREKORE,",",KOREKORE,",.)
replace all_languages= subinstr(all_languages,",CHIKUNDA,",",KUNDA,",.)
replace all_languages= subinstr(all_languages,",CHILAPHALAPHA,",",LAPHALAPHA,",.)
replace all_languages= subinstr(all_languages,",CHILOMWE,",",LOMWE,",.)
replace all_languages= subinstr(all_languages,",CHILOMWE,",",LOMWE,",.)
replace all_languages= subinstr(all_languages,",CHIMANICA,",",MANHICA,",.)
replace all_languages= subinstr(all_languages,",CHIMANYCA,",",MANHICA,",.)
replace all_languages= subinstr(all_languages,",CHIMBULI,",",BUILI,",.)
replace all_languages= subinstr(all_languages,",CHINDALE,",",NDALI,",.)
replace all_languages= subinstr(all_languages,",CHINGONI,",",NGONI,",.)
replace all_languages= subinstr(all_languages,",CHINKHONDE,",",NKHONDE,",.)
replace all_languages= subinstr(all_languages,",CHINYANJA,",",NYANJA,",.)
replace all_languages= subinstr(all_languages,",CHISENA,",",SENA,",.)
replace all_languages= subinstr(all_languages,",CHISENGA,",",SENGA,",.)
replace all_languages= subinstr(all_languages,",LOZ1,",",LOZI,",.)
replace all_languages= subinstr(all_languages,",SILOZI,",",LOZI,",.)
replace all_languages= subinstr(all_languages,",CHITEUE,",",TEWE,",.)
replace all_languages= subinstr(all_languages,",CHITONGA,",",TONGA,",.)
replace all_languages= subinstr(all_languages,",CHITSWA,",",TSWANA,",.)
replace all_languages= subinstr(all_languages,",CHITUMBUKA,",",TUMBUKA,",.)
replace all_languages= subinstr(all_languages,",CHITUMBVUKA,",",TUMBUKA,",.)
replace all_languages= subinstr(all_languages,",CHIWEMBA,",",BEMBA,",.)
replace all_languages= subinstr(all_languages,",CHIYAO,",",YAO,",.)
replace all_languages= subinstr(all_languages,",CHONA,",",SHONA,",.)
replace all_languages= subinstr(all_languages,",CHREWA,",",CHEWA,",.)
replace all_languages= subinstr(all_languages,",DAGAARI,",",DAGARI,",.)
replace all_languages= subinstr(all_languages,",DIEMAK,",",DIEMARK,",.)
replace all_languages= subinstr(all_languages,",DIOLA,",",DIOULA,",.)
replace all_languages= subinstr(all_languages,",DJERME,",",DJERMA,",.)
replace all_languages= subinstr(all_languages,",EDOMA,",",EDO,",.)
replace all_languages= subinstr(all_languages,",FANAKALORE,",",FANAKALOKO,",.)
replace all_languages= subinstr(all_languages,",FILANI,",",FULANI,",.)

replace all_languages= subinstr(all_languages,",FAN�AIS,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FFRAN�AIS,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FFRAN�AIS,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRANC�S,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRAN�,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRAN�A,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRAN�AIS,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FRATSAY,",",FRANCAIS,",.)
replace all_languages= subinstr(all_languages,",FULFUDE,",",FULFULDE,",.)
replace all_languages= subinstr(all_languages,",GLAODA,",",GLANDA,",.)
replace all_languages= subinstr(all_languages,",GLAWDA,",",GLANDA,",.)
replace all_languages= subinstr(all_languages,",GOMANI,",",GOMAI,",.)
replace all_languages= subinstr(all_languages,",GONGA,",",GONJA,",.)
replace all_languages= subinstr(all_languages,",GRUNNA,",",GRUNI,",.)
replace all_languages= subinstr(all_languages,",GRUNSI,",",GRUNI,",.)
replace all_languages= subinstr(all_languages,",GRUSI,",",GRUNI,",.)
replace all_languages= subinstr(all_languages,",GRUSSI,",",GRUNI,",.)
replace all_languages= subinstr(all_languages,",GUJARAT,",",GUJERATI,",.)
replace all_languages= subinstr(all_languages,",GUSHRATI,",",GUJERATI,",.)
replace all_languages= subinstr(all_languages,",GURUMI,",",GURUNI,",.)
replace all_languages= subinstr(all_languages,",GWAGI,",",GWARI,",.)
replace all_languages= subinstr(all_languages,",HAUS,",",HAUSA,",.)
replace all_languages= subinstr(all_languages,",HIGGI,",",HINDI,",.)
replace all_languages= subinstr(all_languages,",HOLAND�S,",",DUTCH,",.)
replace all_languages= subinstr(all_languages,",IBIBO,",",IBIBIO,",.)
replace all_languages= subinstr(all_languages,",ICIBEMBA,",",BEMBA,",.)
replace all_languages= subinstr(all_languages,",IGARA,",",IGALA,",.)
replace all_languages= subinstr(all_languages,",IGBI,",",IGBO,",.)
replace all_languages= subinstr(all_languages,",IJAE,",",IJAW,",.)
replace all_languages= subinstr(all_languages,",IKWERRE,",",IKWERE,",.)
replace all_languages= subinstr(all_languages,",IKWENE,",",IKWERE,",.)
replace all_languages= subinstr(all_languages,",IKWENE,",",IKWERE,",.)
replace all_languages= subinstr(all_languages,",IKERE,",",IKWERE,",.)
replace all_languages= subinstr(all_languages,",IKEKEKE,",",IKWERE,",.)
replace all_languages= subinstr(all_languages,",IKARE,",",IKWERE,",.)

replace all_languages= subinstr(all_languages,",ILAJE,",",ILA,",.)
replace all_languages= subinstr(all_languages,",ILAMUN,",",ILA,",.)
replace all_languages= subinstr(all_languages,",ILLA,",",ILA,",.)
replace all_languages= subinstr(all_languages,",INGL�S,",",ENGLISH,",.)
replace all_languages= subinstr(all_languages,",IONGA,",",TONGA,",.)
replace all_languages= subinstr(all_languages,",IPIE,",",IPIA,",.)
replace all_languages= subinstr(all_languages,",IPUA,",",IPIA,",.)
replace all_languages= subinstr(all_languages,",ISIXHOSA,",",XHOSA,",.)
replace all_languages= subinstr(all_languages,",ISIZULU,",",ZULU,",.)

replace all_languages= subinstr(all_languages,",ITALIANE,",",ITALIAN,",.)
replace all_languages= subinstr(all_languages,",ITALITN,",",ITALIAN,",.)
replace all_languages= subinstr(all_languages,",JANAKALORE,",",JANAKALOR,",.)
replace all_languages= subinstr(all_languages,",JAPANESE,",",JAPONAIS,",.)
replace all_languages= subinstr(all_languages,",KAGORO,",",KAGORU,",.)
replace all_languages= subinstr(all_languages,",KALLENJIN,",",KALENJIN,",.)
replace all_languages= subinstr(all_languages,",KALUNDU,",",KALUNDA,",.)
replace all_languages= subinstr(all_languages,",KARI-KARI,",",KARI,",.)
replace all_languages= subinstr(all_languages,",ATYAP(KATAF),",",KATAF,",.)
replace all_languages= subinstr(all_languages,",KIBUNGO,",",KIBUNGU,",.)
replace all_languages= subinstr(all_languages,",KIBUNGWA,",",KIBUNGU,",.)
replace all_languages= subinstr(all_languages,",KICHAGGA,",",KICHAGA,",.)
replace all_languages= subinstr(all_languages,",KIGOA,",",KIGOGO,",.)
replace all_languages= subinstr(all_languages,",KIGONGO,",",KIGOGO,",.)
replace all_languages= subinstr(all_languages,",KIINGERZA,",",KIINGEREZA,",.)
replace all_languages= subinstr(all_languages,",KIIRAKI,",",KIIRAQI,",.)
replace all_languages= subinstr(all_languages,",KIGIRIAMA,",",GIRIAMA,",.)
replace all_languages= subinstr(all_languages,",KIGIRIAMA,",",GIRIAMA,",.)
replace all_languages= subinstr(all_languages,",KIKWAYA,",",KIKUYU,",.)
replace all_languages= subinstr(all_languages,",KILAMBYA,",",LAMBYA,",.)
replace all_languages= subinstr(all_languages,",LDZI,",",LOZI,",.)
replace all_languages= subinstr(all_languages,",KIMAGINJI,",",KIMAGINGO,",.)
replace all_languages= subinstr(all_languages,",KIMAKONDE,",",MAKONDE,",.)
replace all_languages= subinstr(all_languages,",MACONDE,",",MAKONDE,",.)
replace all_languages= subinstr(all_languages,",KIMAKUE,",",KIMAKUA,",.)
replace all_languages= subinstr(all_languages,",KIMAKUA,",",MAKUA,",.)
replace all_languages= subinstr(all_languages,",KIMALILE,",",KIMALILA,",.)
replace all_languages= subinstr(all_languages,",KIMALILE,",",KIMALILA,",.)
replace all_languages= subinstr(all_languages,",KIMAMBW,",",MAMBWE,",.)
replace all_languages= subinstr(all_languages,",KIMAMBWE,",",MAMBWE,",.)
replace all_languages= subinstr(all_languages,",KIMASAI,",",MASAI,",.)
replace all_languages= subinstr(all_languages,",KLALENJIN,",",KALENJIN,",.)
replace all_languages= subinstr(all_languages,",KMERU,",",MERU,",.)


***Rest Of KI to do****and now going backwards from Z for a bit to rid ennui
replace all_languages= subinstr(all_languages,",XITSONGA,",",TSONGA,",.)
replace all_languages= subinstr(all_languages,",XITSWA,",",TSWA,",.)
replace all_languages= subinstr(all_languages,",WANGAHA,",",WANGARA,",.)
replace all_languages= subinstr(all_languages,",WANGAHA,",",WANGARA,",.)
replace all_languages= subinstr(all_languages,",TSIZULU,",",ZULU,",.)
replace all_languages= subinstr(all_languages,",TSONGE,",",TSONGA,",.)
replace all_languages= subinstr(all_languages,",TOUSSIEN,",",TOUSSIAN,",.)
replace all_languages= subinstr(all_languages,",SOSOTHO,",",SOTHO,",.)
replace all_languages= subinstr(all_languages,",SONINK�,",",SONINKE,",.)
replace all_languages= subinstr(all_languages,",SOC�,",",SOCE,",.)
replace all_languages= subinstr(all_languages,",SILOZI,",",LOZI,",.)
replace all_languages= subinstr(all_languages,",SETSHWANA,",",SETSWANA,",.)
replace all_languages= subinstr(all_languages,",SESWANA,",",SETSWANA,",.)
replace all_languages= subinstr(all_languages,",SEPUTHI,",",SEPHUTHI,",.)
replace all_languages= subinstr(all_languages,",SANTE(GHANA),",",TWI,",.)
replace all_languages= subinstr(all_languages,",PORTUGU�S,",",PORTUGUESE,",.)
replace all_languages= subinstr(all_languages,",PIDGEN,",",PIDGIN,",.)


***Now getting rid of colonial languages

replace all_languages= subinstr(all_languages,",ENGLISH,",",,",.)
replace all_languages= subinstr(all_languages,",FRANCAIS,",",,",.)
replace all_languages= subinstr(all_languages,",FRANCAIS,",",,",.)
replace all_languages= subinstr(all_languages,",PORTUGUESE,",",,",.)
replace all_languages= subinstr(all_languages,",SPANISH,",",,",.)





split all_languages, p(",")
local splits `r(nvars)' 
foreach var of varlist all_languages* {
	replace `var' = trim(`var')
}

///// remove after languages are cleaned
/*
keep all_languages*
rename all_languages full
gen i=_n
reshape long all_languages , i(i) j(number)
drop if all_languages==""
tab all_languages if strpos(all_languages," ")
tab all_languages 
mhj,hm,
/////
*/






gen sopiuimr_NC = -1
gen sopiuimc_NC = -1
gen sopiuimd_NC = -1
forvalues i = 1/`: di _N' {
	di "individual `i': " _cont 
	tempvar understandshim
	gen `understandshim'=0
	forvalues lang = 1/`splits' {
		if all_languages`lang'[`i']!="" {
			di "speaks " all_languages`lang'[`i'] _cont
			replace `understandshim' = 1 if strpos(all_languages,all_languages`lang'[`i'])>0
		}
	}
	sum `understandshim' if COUNTRY==COUNTRY[`i'] & `i'!=_n, meanonly
	replace sopiuimc_NC = r(mean) in `i'
	sum `understandshim' if REGION==REGION[`i'] & `i'!=_n, meanonly
	replace sopiuimr_NC = r(mean) in `i'
	sum `understandshim' if DISTRICT==DISTRICT[`i'] & `i'!=_n, meanonly
	replace sopiuimd_NC = r(mean) in `i'
	di ""
}
gen GroupL=Q3
replace GroupL=. if Q3==-1
sort GroupL
tab GroupL, gen(dummyL_)
foreach var of varlist dummyL_* {
	bys COUNTRY: egen c_meanL_`var' = mean(`var')
	gen c_sqmL_`var' = (c_meanL_`var')^2
	bys REGION: egen r_meanL_`var' = mean(`var')
	gen r_sqmL_`var' = (r_meanL_`var')^2
	bys DISTRICT: egen d_meanL_`var' = mean(`var')
	gen d_sqmL_`var' = (d_meanL_`var')^2
}
egen c_ssqmL = rowtotal(c_sqmL_*)
egen r_ssqmL = rowtotal(r_sqmL_*)
egen d_ssqmL = rowtotal(d_sqmL_*)
gen LF_country_NC = 1-c_ssqmL
gen LF_region_NC = 1-r_ssqmL
gen LF_district_NC = 1-d_ssqmL
drop dummyL_* ?_meanL_* ?_sqmL_* ?_ssqmL


br Q79
gen GroupE=Q79
replace GroupE=. if Q79==-1|Q79>=990
sort GroupE
tab GroupE, gen(dummyE_)

foreach var of varlist dummyE_* {
	bys COUNTRY: egen c_meanE_`var' = mean(`var')
	gen c_sqmE_`var' = (c_meanE_`var')^2
	bys REGION: egen r_meanE_`var' = mean(`var')
	gen r_sqmE_`var' = (r_meanE_`var')^2
	bys DISTRICT: egen d_meanE_`var' = mean(`var')
	gen d_sqmE_`var' = (d_meanE_`var')^2
}
egen c_ssqmE = rowtotal(c_sqmE_*)
egen r_ssqmE = rowtotal(r_sqmE_*)
egen d_ssqmE = rowtotal(d_sqmE_*)
gen EF_country_NC = 1-c_ssqmE
gen EF_region_NC = 1-r_ssqmE
gen EF_district_NC = 1-d_ssqmE
drop dummyE_* ?_meanE_* ?_sqmE_* ?_ssqmE



gen GroupR=Q90
replace GroupR=. if Q90==-1|Q90>995
sort GroupR
tab GroupR, gen(dummyR_)


foreach var of varlist dummyR_* {
	bys COUNTRY: egen c_meanR_`var' = mean(`var')
	gen c_sqmR_`var' = (c_meanR_`var')^2
	bys REGION: egen r_meanR_`var' = mean(`var')
	gen r_sqmR_`var' = (r_meanR_`var')^2
	bys DISTRICT: egen d_meanR_`var' = mean(`var')
	gen d_sqmR_`var' = (d_meanR_`var')^2
}
egen c_ssqmR = rowtotal(c_sqmR_*)
egen r_ssqmR = rowtotal(r_sqmR_*)
egen d_ssqmR = rowtotal(d_sqmR_*)
gen RF_country_NC = 1-c_ssqmR
gen RF_region_NC = 1-r_ssqmR
gen RF_district_NC = 1-d_ssqmR
drop dummyR_* ?_meanR_* ?_sqmR_* ?_ssqmR

rename GroupL GroupL_NC
rename GroupE GroupE_NC
rename GroupR GroupR_NC

keep RESPNO sopiuimr_NC- RF_district_NC

sort RESPNO
save rept_NC_to_match, replace

use Afrobarorep1

merge RESPNO using rept_NC_to_match

save Afrobarorep1, replace
